# 图像分割

import cv2

# 读取图像
image = cv2.imread('./static/1.jpg')
image = cv2.resize(image,(500,500))
# 将图像转换为灰度图像
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# 进行图像分割
_, binary_image = cv2.threshold(gray_image, 127, 255, cv2.THRESH_BINARY)

# 显示原始图像和分割结果
cv2.imshow('Original Image', image)
cv2.imshow('Binary Image', binary_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
